#!/bin/sh

## This is just an example, obviously.  Don't use it without
## editing to suit your setup, or tailoring it to how a distro-
## packaged gdnsd should be set up...

## Generally speaking, gdnsd is its own initscript, you just
##  give it a configfile argument and a command (start/stop/etc..)
##  and it will do the required actions and give you an exit value
##  of 0 on success and 1 on failure.

# What configfile are we using? (this is up to the user)
CONFIG_PATH=/usr/local/etc/gdnsd/config

# Where the gdnsd binary was installed
GDNSD_PATH=/usr/local/sbin/gdnsd

# Shouldn't need to edit this stuff:
GDNSD_CMD="$GDNSD_PATH -c $CONFIG_PATH"

. /lib/init/vars.sh
. /lib/lsb/init-functions

case "$1" in
    start)
        log_daemon_msg "Starting gdnsd"
        $GDNSD_CMD start
	st=$?
        log_end_msg $st
	exit $st
        ;;
    stop)
        log_daemon_msg "Stopping gdnsd"
        $GDNSD_CMD stop
        st=$?
        log_end_msg $st
	exit $st
        ;;
    status)
        $GDNSD_CMD status
        st=$?
        log_end_msg $st
	exit $st
        ;;
    restart|force-reload)
        log_daemon_msg "Restart gdnsd"
        $GDNSD_CMD restart
        st=$?
        log_end_msg $st
	exit $st
        ;;
    *)
        echo "Usage: /etc/init.d/gdnsd {start|stop|status|force-reload|restart}"
        exit 1
esac

exit 0
